package com.tuling.designpattern.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 林瑞涛
 * @desc 具体聚合类
 * @date 2021年08月04日 14:11
 */
public class ConcreteAggregate implements Aggregate{
    private List list = new ArrayList();

    @Override
    public void add(Object obj) {
        list.add(obj);
    }

    @Override
    public void remove(Object obj) {
        list.remove(obj);
    }

    @Override
    public Iterator iterator() {
        return new ConcreteIterator(list);
    }
}
